
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 06/05/2010 13:43:30
-- Generated from EDMX file: D:\Projects\Inspiration.Web\Inspiration.Web\Models\InspirationDatabase.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Inspiration];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------


-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[Nouns]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Nouns];
GO
IF OBJECT_ID(N'[dbo].[Verbs]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Verbs];
GO
IF OBJECT_ID(N'[dbo].[Adjectives]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Adjectives];
GO
IF OBJECT_ID(N'[dbo].[Ideas]', 'U') IS NOT NULL
    DROP TABLE [dbo].[Ideas];
GO
IF OBJECT_ID(N'[dbo].[NewsLetterSubscribers]', 'U') IS NOT NULL
    DROP TABLE [dbo].[NewsLetterSubscribers];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'Nouns'
CREATE TABLE [dbo].[Nouns] (
    [NounId] int IDENTITY(1,1) NOT NULL,
    [Text] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'Verbs'
CREATE TABLE [dbo].[Verbs] (
    [VerbId] int IDENTITY(1,1) NOT NULL,
    [Text] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'Adjectives'
CREATE TABLE [dbo].[Adjectives] (
    [AdjectiveId] int IDENTITY(1,1) NOT NULL,
    [Text] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'Ideas'
CREATE TABLE [dbo].[Ideas] (
    [IdeaId] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [OwnerName] nvarchar(256)  NULL,
    [OwnerId] uniqueidentifier  NOT NULL,
    [InUsed] bit  NOT NULL,
    [ApplicationName] nvarchar(256)  NOT NULL
);
GO

-- Creating table 'NewsLetterSubscribers'
CREATE TABLE [dbo].[NewsLetterSubscribers] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [OwnerName] nvarchar(max)  NOT NULL,
    [OwnerId] uniqueidentifier  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [NounId] in table 'Nouns'
ALTER TABLE [dbo].[Nouns]
ADD CONSTRAINT [PK_Nouns]
    PRIMARY KEY CLUSTERED ([NounId] ASC);
GO

-- Creating primary key on [VerbId] in table 'Verbs'
ALTER TABLE [dbo].[Verbs]
ADD CONSTRAINT [PK_Verbs]
    PRIMARY KEY CLUSTERED ([VerbId] ASC);
GO

-- Creating primary key on [AdjectiveId] in table 'Adjectives'
ALTER TABLE [dbo].[Adjectives]
ADD CONSTRAINT [PK_Adjectives]
    PRIMARY KEY CLUSTERED ([AdjectiveId] ASC);
GO

-- Creating primary key on [IdeaId] in table 'Ideas'
ALTER TABLE [dbo].[Ideas]
ADD CONSTRAINT [PK_Ideas]
    PRIMARY KEY CLUSTERED ([IdeaId] ASC);
GO

-- Creating primary key on [Id] in table 'NewsLetterSubscribers'
ALTER TABLE [dbo].[NewsLetterSubscribers]
ADD CONSTRAINT [PK_NewsLetterSubscribers]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------